package br.com.lazyprogrammer.spaceshooter.model;

import br.com.limaogames.framework.math.Vector2;
import br.com.limaogames.framework.model.DynamicGameObject;

/**
 * Created by Andre on 21/08/2014.
 */
public class Shot extends DynamicGameObject {

    public static final float DEFAULT_SPEED = 2.0f;
    public static final int DAMAGE = 1;

    public Shot(float x, float y, float width, float height, float angle) {
        super(x, y, width, height);

        float radian = angle * Vector2.TO_RADIANS;
        velocity.set((float) Math.cos(radian) * DEFAULT_SPEED, (float) Math.sin(radian) * DEFAULT_SPEED);
    }

    public void update(float deltaTime) {
        position.add(velocity.x * deltaTime, velocity.y * deltaTime);
        bounds.lowerLeft.set(position).sub(bounds.width / 2, bounds.height / 2);
    }
}
